package com.sunrise.controller.auth;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import result.GraceJSONResult;
import java.util.HashMap;
import java.util.Map;

/**
 * @author liansen
 * @create 04-19-20:02
 */
@RestController
@RequestMapping("/user")
public class LoginController {

    @PostMapping("/login")
    public GraceJSONResult login(){
        Map<String, Object> map = new HashMap<>();
        map.put("token", "admin");
        return GraceJSONResult.ok(map);
    }

    @GetMapping("/info")
    public GraceJSONResult info(){
        Map<String, Object> map = new HashMap<>();
        map.put("roles", "[admin]");
        map.put("name", "admin");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return GraceJSONResult.ok(map);
    }

    @PostMapping("/logout")
    public GraceJSONResult logout(){
        return GraceJSONResult.ok();
    }
}
